package com.codedancer.campus.common.config;

import lombok.Data;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Configuration;
import org.springframework.stereotype.Component;

@ConfigurationProperties("redis")
@Component
@Data
public class RedisConfig {

    // 地址
    private String host;
    // 端口
    private Integer port;
    // 密码
    private String password;
    // 超时时间
    private Integer timeout;
    // 验证码库 0
    private Integer smsDatabase;
    // 浏览记录库 1
    private Integer viewDatabase;
    // 评论记录库 2
    private Integer commentDatabase;
    // 点赞记录库 3
    private Integer kudosDatabase;
    // 数据缓存库
    private Integer dataCacheDataBase;

    @Autowired
    private RedisPoolConfig redisPoolConfig;

    @Data
    @Configuration
    @ConfigurationProperties("redis.pool")
    public static class RedisPoolConfig {
        // 最大活跃数
        private Integer maxActive;
        private Integer maxIdle;
        private Integer minIdle;
        private Integer maxWait;
    }
}
